home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16403 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.5 KB

  1. Path: news.wwa.com!rmartin
  2. From: rmartin@oma.com (Robert C. Martin)
  3. Newsgroups: comp.lang.smalltalk,comp.object,comp.lang.c++,comp.lang.java
  4. Subject: Re: The Good, the Bad, the Ugly, and the Wicked ...
  5. Date: 10 Apr 1996 18:40:14 GMT
  6. Organization: Object Mentor
  7. Message-ID: <RMARTIN.96Apr10134014@rcm.oma.com>
  8. References: <31570B8E.5A12@vmark.com> <4je5rq$7qg@mimas.brunel.ac.uk>
  9.     <RMARTIN.96Apr9160010@rcm.oma.com> <goochb.325.00160E30@rwi.com>
  10. NNTP-Posting-Host: rcm.oma.com
  11. In-reply-to: goochb@rwi.com's message of Tue, 9 Apr 1996 22:03:10
  12.  
  13. In article <goochb.325.00160E30@rwi.com> goochb@rwi.com (William D. Gooch) writes:
  14.  
  15. Matt Kennel writes:
  16.    >   A garbage collector provides a potential solution that is very
  17.    >   difficult to do without.
  18.  
  19. rmartin@oma.com (Robert C. Martin) writes:
  20.  
  21.    >In some cases.  In others it is difficult to live with.  There is
  22.    >no generic solution.
  23.  
  24.    Cute, but a litle too glib perhaps.  Since (from what you wrote earlier)
  25.    you know that a quality GC implementation allows one to turn it on 
  26.    and off, force collection, and do one's own memory management,
  27.    what basis does that leave for GC being "hard to live with?" 
  28.  
  29. I said it was hard to live with "in some cases". And my meaning was
  30. that there are cases in which automatic collection of garbage is not a
  31. good option.  Specifically I am talking about those cases where the
  32. management of the automatic collector becomes more complex than the
  33. manual management of memory.
  34.  
  35. This happens in real time systems when you enter a very critical
  36. stretch of code.  You cannot afford a collection within this stretch.
  37. So you turn off collection before you enter it.  (Forget to do this,
  38. and you have an intermittent system crash). 
  39.  
  40. But if you turn off collection, you risk running out of memory.  The
  41. system might just be running out when you decide to turn off
  42. collection.  Now your critical stretch of code fails because it ran
  43. out of memory...  So you have to do a collection before you enter the
  44. critical section, and before you turn collection off.
  45.  
  46. Then you have to remember to turn collection back on when you exit the
  47. critical section.....
  48.  
  49. Please understand,  I am not arguing against GC.  I am saying that GC
  50. is not a foolproof solution.  There are times when managing GC is just
  51. as complex as manual memory management.
  52.  
  53.  
  54.  
  55.  
  56. --
  57. Robert Martin       | Design Consulting   | Training courses offered:
  58. Object Mentor Assoc.| rmartin@oma.com     |   OOA/D, C++, Advanced OO
  59. 14619 N. Somerset Cr| Tel: (847) 918-1004 |   Mgt. Overview of OOT
  60. Green Oaks IL 60048 | Fax: (847) 918-1023 | http://www.oma.com
  61.  
  62.